package com.mzj.saas.mservice.eligible.repository;

import com.mzj.saas.mservice.eligible.entity.HouseCohabitMaterial;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

public interface HouseCohabitMaterialRepository extends PagingAndSortingRepository<HouseCohabitMaterial, Long>, JpaSpecificationExecutor<HouseCohabitMaterial> {
    List<HouseCohabitMaterial> findByCohabitId(String cohabitId);

    List<HouseCohabitMaterial> findByCohabitIdAndMaterialType(String cohabitId, Integer materialType);

    @Transactional
    void deleteByCohabitIdAndMaterialType(String cohabitId, Integer materialType);

    void deleteByCohabitId(String cohabitId);
}
